package com.zhike.b2b.user.impl;

import com.saas.biz.dao.custDAO.CustomerExt;
import com.saas.biz.dao.userDAO.UserExt;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;
import com.zhike.b2b.dao.Dbtable;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

public class UserCheckMgr
{
  Dbtable tradeQuery = new Dbtable();
  Logger log = new Logger(this);
  Buffers inBuffer;
  Buffers outBuffer;

  public void setTradeQuery(Dbtable paramDbtable)
  {
    this.tradeQuery = paramDbtable;
  }

  public Dbtable getTradeQuery()
  {
    return this.tradeQuery;
  }

  public void setOutBuffer(Buffers paramBuffers)
  {
    this.outBuffer = paramBuffers;
  }

  public Buffers getOutBuffer()
  {
    return this.outBuffer;
  }

  public boolean Exists(String paramString)
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_NAME", paramString);
    ArrayList localArrayList = localUserExt.selByList("SEL_BY_CHECK");
    return (localArrayList == null) || (localArrayList.size() == 0);
  }

  public HashMap Exists(String paramString1, String paramString2)
    throws SaasApplicationException
  {
    UserExt localUserExt = new UserExt();
    HashMap localHashMap = new HashMap();
    localUserExt.setParam(":VUSER_NAME", paramString1);
    ArrayList localArrayList = localUserExt.selByList("SEL_BY_CHECK");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      localHashMap = (HashMap)localArrayList.get(0);
    return localHashMap;
  }

  public ArrayList genSpecCustInfo(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    CustomerExt localCustomerExt = new CustomerExt();
    localCustomerExt.setParam(":VCUST_ID", paramString);
    localArrayList = localCustomerExt.selByList("SEL_SPEC_CUST");
    return localArrayList;
  }

  public int checktCustInfo(String paramString1, String paramString2)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    String str = "";
    if ((localArrayList != null) && (localArrayList.size() != 0))
    {
      Iterator localIterator = localArrayList.iterator();
      localIterator.hasNext();
      HashMap localHashMap = (HashMap)localIterator.next();
      str = localHashMap.get("password").toString();
      if (!str.equals(paramString2))
        return -2;
      return 0;
    }
    return -1;
  }
}

